﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQuarters.WebQuarters.Modules.ItemList;
using OpenQuarters.WebQuarters.Core;
using OpenQuarters.WebQuarters.Utils;

namespace OpenQuarters.WebQuarters.Modules.Articles
{
    public class ArticlesModule : ItemListModuleBase<Article>, IItemListModule<Article>
    {
        private string defaultCategory = "";

        [PropertyConfiguration(PropertyType.TextBox)]
        [Newtonsoft.Json.JsonProperty]
        public string Default_Category
        {
            get { return defaultCategory; }
            set { defaultCategory = value; }
        }

        public ArticlesModule()
            : base()
        {
        }

        public override void Initialise()
        {
            this.ModuleName = "Articles Module";
            this.ModuleDescription = "Provides a list of articles for creating news article areas";
        }


        #region IItemListModule<Article> Members

        public override List<Article> ChildItems()
        {
            //return new List<Article>();
            return base.ChildItems().Cast<Article>().Where(a => a.IsLive).ToList();
        }

        public override Article CurrentItem()
        {
            return base.CurrentItem();
        }

        #endregion
    }
}
